package pl.com.kyhu.dietex3000.GUI.cards;

import java.util.ArrayList;

import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Text;
import org.eclipse.wb.swt.SWTResourceManager;

import pl.com.kyhu.dietex3000.GUI.components.MealTree;
import pl.com.kyhu.dietex3000.database.beans.Meal;
import pl.com.kyhu.dietex3000.utils.Constants;

public class DataCard extends Composite {
	
	MealTree dataTree;
	Text recipeLabel;
	
	public DataCard(Composite parent, int style) {
		super(parent, SWT.BORDER);
		
		RowLayout rowLayout = new RowLayout(SWT.HORIZONTAL);
		rowLayout.fill = true;
		rowLayout.marginTop = 5;
		rowLayout.marginRight = 2;
		rowLayout.marginLeft = 2;
		rowLayout.marginBottom = 2;
		rowLayout.marginHeight = 5;
		rowLayout.marginWidth = 2;
		rowLayout.spacing = 10;
		setLayout(rowLayout);

		dataTree = new MealTree(this, SWT.NONE);
	
		dataTree.setLayoutData(new RowData(191, 303));

		recipeLabel = new Text(this, SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
		recipeLabel.setFont(SWTResourceManager.getFont("Microsoft Sans Serif", 8, SWT.BOLD));

		recipeLabel.setLayoutData(new RowData(276, 285));
		recipeLabel.setText(Constants.recipes);

		dataTree.setRecipeText(recipeLabel);

	}

	public ArrayList<Meal> getAvailableMeals() {
		return dataTree.getCheckedMeals();
	}

}
